package com.java.tutorials.spring.ClassPathXmlApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
/**
 * Created by xuzhike on 2016/3/13.
 * http://www.java2s.com/Code/Java/Spring/LoadconfigfilefromClassPath.htm
 *
 Load config file from ClassPath
 */
@Magic
class SimpleBean {
    private Dependency dependency;

    @Autowired(required = true)
    public void setDependency(Dependency dependency) {
        this.dependency = dependency;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("SimpleBean");
        sb.append(ObjectUtils.identityToString(this));
        sb.append("{dependency=").append(dependency);
        sb.append('}');
        return sb.toString();
    }
}
@Component
class Dependency {

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Dependency");
        sb.append(ObjectUtils.identityToString(this));
        sb.append("{}");
        return sb.toString();
    }
}
